package com.cy.server.service.impl;

import com.cy.server.dto.PositionDto;
import com.cy.server.pojo.Position;
import com.cy.server.mapper.PositionMapper;
import com.cy.server.service.IPositionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author LiShaoZhuo
 * @since 2021-04-26
 */
@Service
public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> implements IPositionService {

    @Autowired
    PositionMapper positionMapper;

    /**
     * @Description: 职位信息分页
     * @Param: positionDto
     * @return:
     * @Author: LiShaoZhuo
     * @Date: 2021/4/30
     */
    @Override
    public PageInfo<Position> selectAllPositions(PositionDto positionDto) {
        PageHelper.startPage(positionDto.getCurrentPage(), positionDto.getPageSize());
        List<Position> list = positionMapper.selectAllPositions(positionDto);
        PageInfo<Position> pageInfo = new PageInfo<Position>(list);
        return pageInfo;
    }
}
